package 力扣日常刷题.木22一月.第15天0127;

import java.util.HashSet;

/**
 * @author 帅小伙
 * @date 2022/1/27
 * @description
 */
public class Demo02简单字符串宝石和石头 {


    public int numJewelsInStones(String jewels, String stones) {
        HashSet<Character> set = new HashSet<Character>();
        for (char c : jewels.toCharArray()) {
            set.add(c);
        }
        int ans = 0;
        for (char c : stones.toCharArray()) {
            if(set.contains(c)) {
                ans++;
            }

        }
        return ans;
    }

}
